package com.kikt.rxjavaandretrofit

import com.kikt.rxjavaandretrofit.api.GankApi
import com.kikt.rxjavaandretrofit.bean.DayBean
import com.kikt.rxjavaandretrofit.bean.DataBean
import com.kikt.rxjavaandretrofit.bean.Response
import io.reactivex.Observable

/**
 * Created by cai on 2017/7/21.
 */
class MainModelImpl : MainModel {

    val gankApi:GankApi by lazy {
        retrofit.create(GankApi::class.java)
    }

    override fun getRandom(): Observable<DataBean> {
        return gankApi.randomData()
    }

    override fun getDay(year: Int, month: Int, day: Int): Observable<DayBean> {
        return gankApi.getDataFromDay(year, month, day)
    }

    override fun getCategory(category: String, count: Int, page: Int): Observable<Response> {
        return gankApi.getDataFromCategory(category, count, page)
    }

}